import { Badge } from "view-ui-plus";

export const getDictLabel = (dicts: any[], value: string) => {
  const obj = dicts.find((item) => item.value === value);
  if (obj) {
    if (obj.color) {
      return <Badge text={obj.label} color={obj.color} />;
    } else {
      return obj.label;
    }
  }
  return "";
};

export const getTableDictLabel = (dicts: any[], dictValue: string) => {
  const obj = dicts.find((item) => item.dictValue === dictValue);
  if (obj) {
    return obj.dictLabel;
  }
  return "";
};

export const detectionTypes = [
  { label: "产品", value: "0" },
  { label: "环境", value: "1" },
  { label: "投入品", value: "2" },
  { label: "苗种", value: "3" },
  { label: "病害", value: "4" },
];
//制样任务分配状态
export const distributionStatuss = [
  { label: "未分配", value: "0" },
  { label: "已分配", value: "1" },
];

// 任务来源
export const scheduleSource = [
  { value: "0", label: "环境" },
  { value: "1", label: "监督" },
  { value: "2", label: "例行" },
  { value: "3", label: "农安办" },
  { value: "4", label: "投入品苗种" },
  { value: "5", label: "投入品饲料" },
  { value: "6", label: "投入品渔药" },
  { value: "7", label: "委托检测" },
  { value: "8", label: "付费项目" },
  { value: "9", label: "鉴定" },
  { value: "10", label: "无公害" },
  { value: "11", label: "风险排查" },
];

//合同状态
export const contractStatuss = [
  { value: "0", label: "未提交", color: "orange" },
  { value: "1", label: "待审核", color: "geekblue" },
  { value: "2", label: "已驳回", color: "red" },
  { value: "3", label: "已通过", color: "green" },
];

// 采样区县
export const samplingAreaCode = [
  {
    value: "HS",
    label: "海曙区",
  },
  {
    value: "JB",
    label: "江北区",
  },
  {
    value: "BL",
    label: "北仑区",
  },
  {
    value: "ZH",
    label: "镇海区",
  },
  {
    value: "YZ",
    label: "鄞州区",
  },
  {
    value: "FH",
    label: "奉化区",
  },
  {
    value: "XS",
    label: "象山县",
  },
  {
    value: "NH",
    label: "宁海县",
  },
  {
    value: "YY",
    label: "余姚市",
  },
  {
    value: "CX",
    label: "慈溪市",
  },
];
